package cn.xshi.sys.service.impl;
import java.util.List;
import java.util.Map;

import cn.xshi.sys.dao.SysConcordatDao;
import cn.xshi.sys.service.SysConcordatService;
import cn.xshi.common.base.BaseService;
import cn.xshi.common.util.ExceptionUtil;
import cn.xshi.sys.model.SysConcordat;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
/**
 * @Desc 合同管理
 * @Author 邓纯杰
 * @CreateTime 2012-12-12 12:12:12
 */
@Service
public class SysConcordatServiceImpl extends BaseService implements SysConcordatService {

	@Resource
	private SysConcordatDao sysConcordatDao;

	/**
	 * 分页
	 * @param condition
	 * @return
	 */
	public List<SysConcordat> getSysConcordatListByCondition(Map<String,Object> condition){
		try {
			return sysConcordatDao.getSysConcordatListByCondition(condition);
		} catch (Exception e) {
			throw new ExceptionUtil(e.getMessage(),e.getCause());
		}
	}

	/**
	 * 查询对象
	 * @param id
	 * @return
	 */
	public SysConcordat getSysConcordatById(String id){
		try {
			return sysConcordatDao.getSysConcordatById(id);
		} catch (Exception e) {
			throw new ExceptionUtil(e.getMessage(),e.getCause());
		}
	}

	/**
	 * 添加
	 * @param sysConcordat
	 * @return
	 */
	public int addSysConcordat(SysConcordat sysConcordat){
		int i = 0;
		try {
			sysConcordat.setId(toUUID());
			sysConcordat.setCreateId(getCurrentAccountId());
			sysConcordat.setCreateTime(getDate());
			i = sysConcordatDao.addSysConcordat(sysConcordat);
		} catch (Exception e) {
			throw new ExceptionUtil(e.getMessage(),e.getCause());
		}
		return i;
	}

	/**
	 * 修改
	 * @param sysConcordat
	 * @return
	 */
	public int updateSysConcordat(SysConcordat sysConcordat){
		int i = 0;
		try {
			sysConcordat.setUpdateId(getCurrentAccountId());
			sysConcordat.setUpdateTime(getDate());
			i = sysConcordatDao.updateSysConcordat(sysConcordat);
		} catch (Exception e) {
			throw new ExceptionUtil(e.getMessage(),e.getCause());
		}
		return i;
	}

	/**
	 * 删除
	 * @param condition
	 * @return
	 */
	public int delSysConcordat(Map<String,Object> condition){
		int i = 0;
		try {
			i = sysConcordatDao.delSysConcordat(condition);
		} catch (Exception e) {
			throw new ExceptionUtil(e.getMessage(),e.getCause());
		}
		return i;
	}
}
